#ifndef CLIENTUI_H
#define CLIENTUI_H

#include<QWidget>
#include<QListWidget>
#include<QLineEdit>
#include<QLabel>
#include<QPushButton>
#include<QTcpSocket>
#include<QGridLayout>
#include"ClientSocket.h"
#include"HistoryUI.h"

class ClientUI : public QWidget
{
    Q_OBJECT

public:
    ClientUI(QWidget *parent = 0);
    ~ClientUI();

signals:
    void sendMsg(QString);
    void connectServer(QString,QString);
    void disconnectServer();
    void updateHistoryUI(QString);
public slots:
    void slotSendMsg();
    void slotSwitch();
    void slotConnected();
    void slotdisconnected();
    void slotupdateClient(QString);
    void slotShowhistory();
    void slotupdateHistory(QString);

private:
    bool isConnected;
    int port;
    ClientSocket *clientSocket;
    HistoryUI *historyUI;

    QListWidget *ListWidgetnews;
    QLineEdit *LineEditmsg;
    QLineEdit *LineEditname;
    QLineEdit *LineEditserverIp;
    QLineEdit *LineEditport;
    QLabel *LabelName;
    QLabel *LabelServerIP;
    QLabel *LabelPort;
    QPushButton *BtnsendMsg;
    QPushButton *Btnswitch;
    QPushButton *Btnhistory;
    QGridLayout *mainLayout;
};

#endif // CLIENTUI_H
